g13baf
g13baf
© Numerical Algorithms Group, 2002.
Purpose
G13BAF Multivariate time series, filtering (pre-whitening) by an
ARIMA model
Synopsis
[b,ifail] = g13baf(y,mr,par<,cy,ifail>)
Description
From a given series y ,y ,...,y , a new series b ,b ,...,b is
1 2 n 1 2 n
calculated using a supplied (filtering) ARIMA model. This model
will be one which has previously been fitted to a series x with
t
residuals a . The equations defining b in terms of y are very
t t t
similar to those by which a is obtained from x . The only
t t
dissimilarity is that no constant correction is applied after
differencing. This is because the series y is generally distinct
t
from the series x with which the model is associated, though y
t t
may be related to x . Whilst it is appropriate to apply the ARIMA
t
model to y so as to preserve the same relationship between b
t t
and a as exists between y and x , the constant term in the
t t t
ARIMA model is inappropriate for y . The consequence is that b
t t
will not necessarily have zero mean.
The equations are precisely:
d D
w =(nabla) (nabla) y , (1)
t s t
the appropriate differencing of y ; both the seasonal and non-
t
seasonal inverted autoregressive operations are then applied,
u =w -(Phi) w -...-(Phi) w (2)
t t 1 t-s P t-s*P
v =u -(phi) u -...-(phi) u (3)
t t 1 t-1 p t-p
followed by the inverted moving average operations
z =v +(Theta) z +...+(Theta) z (4)
t t 1 t-s Q t-s*Q
b =z +(theta) b +...+(theta) b . (5)
t t 1 t-1 q t-q
Because the filtered series value b depends on present and past
t
values y ,y ,... there is a problem arising from ignorance of
t t-1
y ,y ,... which particularly affects calculation of the early
0 -1
values b ,b ,..., causing 'transient errors'. The routine allows
1 2
two possibilities.
(i) The equations (1), (2) and (3) are applied from
successively later time points so that all terms on their
right-hand sides are known, with v being defined for
t
t=(1+d+s*D+s*P),...,n. Equations (4) and (5) are then
applied over the same range, taking any values on the
right-hand side associated with previous time points, to be
zero.
This procedure may still however result in unacceptably
large transient errors in early values of b .
t
(ii) The unknown values y ,y ,... are estimated by
0 -1
backforecasting. This requires that an ARIMA model distinct
from that which has been supplied for filtering, should
have been previously fitted to y .
t
For efficiency, the user is asked to supply both this ARIMA model
for y , and a limited number of backforecasts which are prefixed
t
to the known values of y . Within the routine further
t
backforecasts of y , and the series w , u , v in (1), (2), (3)
t t t t
are then easily calculated, and a set of linear equations solved
for backforecasts of z ,b for use in (4) and (5) in the case
t t
that q+Q>0.
Even if the best model for y is not available, a very
t
approximate guess such as
y =c+e
t t
or
(nabla)y =e
t t
can help to reduce the transients substantially.
The backforecasts which need to be prefixed to y are of length
t
Q' =q +s *Q where q and Q are the non-seasonal and seasonal
y y y y y y
moving average orders and s the seasonal period, for the ARIMA
y
model of y . Thus the user need not carry out the backforecasting
t
exercise if Q' =0. Otherwise, the series y ,y ,...,y should be
y 1 2 n
reversed to obtain y ,y ,...,y and G13AJF should be used to
n n-1 1
^ ^
forecast Q' values, y ,...,y . The ARIMA model used is that
y 0 1-Q'
y
fitted to y (as a forward series) except that if d +D is odd,
t y y
the constant should be changed in sign (to allow e.g. for the
fact that a forward upward trend is a reversed downward trend).
The ARIMA model for y supplied to the filtering routine must
t
however have the appropriate constant for the forward series.
^ ^
The series y ,...,y ,y ,...,y is then supplied to the
1-Q' 0 1 n
y
routine, and a corresponding set of values returned for b .
t
Parameters
g13baf
Required Input Arguments:
y (:) real
mr (:) integer
par (:) real
Optional Input Arguments: <Default>
cy real 0
ifail integer -1
Output Arguments:
b (:) real
ifail integer